const fs = require("fs");
const path = require("path");
const filePath = path.join(__dirname, "test.txt");
const toPath = path.join(__dirname, "to.txt");
//创建可读流
let readStream = fs.createReadStream(filePath);

//创建可写流
let writeStream = fs.createWriteStream(toPath);


//通过流的方式把数据进行写入
readStream.pipe(writeStream);